<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- react的根元素 插入一个根组件 -->
    <div id="example"></div>
</body>
</html>
<script src="./js/react.development.js"></script>
<script src="./js/react-dom.development.js"></script>
<script src="./js/prop-types.js"></script>
<script src="./js/babel.js"></script>

<script type="text/babel">
    class MyComponent extends React.Component{
        constructor(props)
        {
            super(props)
        }

        render()
        {
            return(
                <div>
                    <h3>{this.props.title}</h3>
                </div>
            )
        }
    }

    //引入第三方的prop-types 库 进行属性验证
    MyComponent.propTypes = {
        title: PropTypes.string, //必须是字符串类型
    }

    ReactDOM.render(
        <MyComponent title="hello world" />,
        document.getElementById('example')
    )
</script>